home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 1996 March / Amiga-CD 1996 #3.iso / pd-software / mui_3.1 / developer / extclasses / mcc_userdata / showuserdata.c < prev    next >
C/C++ Source or Header  |  1996-01-19  |  2KB  |  87 lines

  1. /*
  2. ** Little tool to show the UserData custom class.
  3. */
  4.  
  5. #include "demo.h"
  6. #include "UserData_mcc.h"
  7.  
  8.  
  9. int main(int argc,char *argv[])
  10. {
  11.     Object *app,*window,*sasg;
  12.  
  13.     init();
  14.  
  15.     app = ApplicationObject,
  16.         MUIA_Application_Title      , "ShowUserData",
  17.         MUIA_Application_Version    , "$VER: ShowUserData 12.9 (21.11.95)",
  18.         MUIA_Application_Copyright  , "©1994 by Stefan Stuntz",
  19.         MUIA_Application_Author     , "Stefan Stuntz",
  20.         MUIA_Application_Description, "Show the UserData custom class",
  21.         MUIA_Application_Base       , "SHOWUSERDATA",
  22.  
  23.         SubWindow, window = WindowObject,
  24.             MUIA_Window_Title, "Show the UserData public custom class",
  25.             MUIA_Window_ID   , MAKE_ID('S','A','S','G'),
  26.  
  27.             WindowContents, VGroup,
  28.  
  29.                 Child, sasg = MUI_NewObject(MUIC_UserData,
  30.                     MUIA_UserData_First  , "Jo",
  31.                     MUIA_UserData_Name   , "User",
  32.                     MUIA_UserData_Street , "Fakestreet 12",
  33.                     MUIA_UserData_City   , "Faketown, FT 1234",
  34.                     MUIA_UserData_Country, "Wonderland",
  35.                     MUIA_UserData_Phone  , "+1-234-567-8901",
  36.                     MUIA_UserData_EMail  , "jouser@fake.wonder.land",
  37.                     TAG_DONE),
  38.  
  39.                 End,
  40.             End,
  41.         End;
  42.  
  43.     if (!app)
  44.         fail(app,"Failed to create Application.");
  45.  
  46.  
  47. /*
  48. ** Install notification events...
  49. */
  50.  
  51.     DoMethod(window,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
  52.         app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
  53.  
  54.  
  55. /*
  56. ** This is the ideal input loop for an object oriented MUI application.
  57. ** Everything is encapsulated in classes, no return ids need to be used,
  58. ** we just check if the program shall terminate.
  59. ** Note that MUIM_Application_NewInput expects sigs to contain the result
  60. ** from Wait() (or 0). This makes the input loop significantly faster.
  61. */
  62.  
  63.     set(window,MUIA_Window_Open,TRUE);
  64.  
  65.     {
  66.         ULONG sigs = 0;
  67.  
  68.         while (DoMethod(app,MUIM_Application_NewInput,&sigs) != MUIV_Application_ReturnID_Quit)
  69.         {
  70.             if (sigs)
  71.             {
  72.                 sigs = Wait(sigs | SIGBREAKF_CTRL_C);
  73.                 if (sigs & SIGBREAKF_CTRL_C) break;
  74.             }
  75.         }
  76.     }
  77.  
  78.     set(window,MUIA_Window_Open,FALSE);
  79.  
  80.  
  81. /*
  82. ** Shut down...
  83. */
  84.  
  85.     fail(app,NULL);
  86. }
  87.